# from hytest  import *
# from lib.api import *
# import re,json
#
#
# def suite_setup():
#     INFO('返回token')
#     response = requests.post("http://******************/api/v1/auth/userToken",
#                              json={"userAccount": "******************", "password": "******************"}
#                              )
#     global auth_token
#     auth_token = str(response.json()["data"]["token"])
#
#
#
#
# class API_4030:
#     name = 'API_4030'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO("前置条件：token正确，'pointKey':'98609701'正确,'machineName':'mc001'正确,'userName':'user001'正确")
#         urlpara = {
#             'pointKey':'98609701',
#             'machineName':'mc001',
#             'userName':'user001'
#         }
#         response = requests.post("http://******************/services/Message/alarm",
#                                  headers={
#                                      "auth-token": auth_token
#                                  },
#                                  params=urlpara
#                                  )
#         expectedResult='''
# {
#     "status": "success",
#     "msg": "请求成功",
#     "code": 0,
#     "type": null,
#     "data": null
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))
#
#
#
#
#
# class API_4031:
#     name = 'API_4031'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO('前置条件：用户名正确，密码正确')
#         urlpara = {
#             'pointKey':'98609701',
#             'machineName':'mc001',
#             'userName':'user001'
#         }
#         response = requests.post("http://******************/services/Message/alarm",
#                                  headers={
#                                      "auth-token": 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlS2V5IjoiIiwidXNlck5hbWUiOiJ5enlhZG1pbiIsImV4cCI6MTYyMjAwNjg2NCwidXNlcklkIjoieXp5YWRtaW4ifQ.-fJYSIJdfbiSabU71x9nbb2n2qbl8IM_s6xk0LuNVfk'
#                                  },
#                                  params=urlpara
#                                  )
#         expectedResult='''
# {
#     "status": "false",
#     "msg": "请求失败",
#     "code": 1,
#     "type": null,
#     "data": 0
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))
#
#
#
#
# class API_4032:
#     name = 'API_4032'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO('前置条件：用户名正确，密码正确')
#         urlpara = {
#             'pointKey':'98609701',
#             'machineName':'mc001',
#             'userName':'user001'
#         }
#         response = requests.post("http://******************/services/Message/alarm",
#                                  # headers={
#                                  #     "auth-token": auth_token
#                                  # },
#                                  params=urlpara
#                                  )
#         expectedResult='''
# {
#     "status": "false",
#     "msg": "请求失败",
#     "code": 1,
#     "type": null,
#     "data": 0
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))
#
#
#
#
#
#
#
#
#
# class API_4033:
#     name = 'API_4033'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO("前置条件：token正确，'pointKey':'11198609701'错误,'machineName':'mc001'正确，'userName':'user001'正确")
#         urlpara = {
#             'pointKey':'11198609701',
#             'machineName':'mc001',
#             'userName':'user001'
#         }
#         response = requests.post("http://******************/services/Message/alarm",
#                                  headers={
#                                      "auth-token": auth_token
#                                  },
#                                  params=urlpara
#                                  )
#         expectedResult='''
# {
#     "status": "false",
#     "msg": "请求失败",
#     "code": 1,
#     "type": null,
#     "data": 0
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))
#
#
#
# class API_4034:
#     name = 'API_4034'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO("前置条件：token正确，'pointKey'不填,'machineName':'mc001'正确，'userName':'user001'正确")
#         urlpara = {
#             # 'pointKey':'98609701',
#             'machineName':'mc001',
#             'userName':'user001'
#         }
#         response = requests.post("http://******************/services/Message/alarm",
#                                  headers={
#                                      "auth-token": auth_token
#                                  },
#                                  params=urlpara
#                                  )
#         expectedResult='''
# {
#     "status": "false",
#     "msg": "请求失败",
#     "code": 1,
#     "type": null,
#     "data": 0
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))
#
#
#
# class API_4035:
#     name = 'API_4035'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO("前置条件：用户名正确，密码正确")
#         urlpara = {
#             'pointKey':'98609701',
#             'machineName':'mc00001',
#             'userName':'user001'
#         }
#         response = requests.post("http://******************/services/Message/alarm",
#                                  headers={
#                                      "auth-token": auth_token
#                                  },
#                                  params=urlpara
#                                  )
#         expectedResult='''
# {
#     "status": "false",
#     "msg": "请求失败",
#     "code": 1,
#     "type": null,
#     "data": 0
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))
#
#
#
#
# class API_4036:
#     name = 'API_4036'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO("token正确， 'pointKey':'98609701'正确，'machineName'不填，'userName':'user001'正确")
#         urlpara = {
#             'pointKey':'98609701',
#             # 'machineName':'mc001',
#             'userName':'user001'
#         }
#         response = requests.post("http://******************/services/Message/alarm",
#                                  headers={
#                                      "auth-token": auth_token
#                                  },
#                                  params=urlpara
#                                  )
#         expectedResult='''
# {
#     "status": "false",
#     "msg": "请求失败",
#     "code": 1,
#     "type": null,
#     "data": 0
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))
#
#
#
# class API_4037:
#     name = 'API_4037'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO('前置条件：用户名正确，密码正确')
#         urlpara = {
#             'pointKey':'98609701',
#             'machineName':'mc001',
#             'userName':'user0000001'
#         }
#         response = requests.post("http://******************/services/Message/alarm",
#                                  headers={
#                                      "auth-token": auth_token
#                                  },
#                                  params=urlpara
#                                  )
#         expectedResult='''
# {
#     "status": "false",
#     "msg": "请求失败",
#     "code": 1,
#     "type": null,
#     "data": 0
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))
#
#
#
# class API_4038:
#     name = 'API_4038'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO('前置条件：用户名正确，密码正确')
#         urlpara = {
#             'pointKey':'98609701',
#             'machineName':'mc001',
#             'userName':'user001'
#         }
#         response = requests.post("http://******************/services/Message/alarm",
#                                  headers={
#                                      "auth-token": auth_token
#                                  },
#                                  params=urlpara
#                                  )
#         expectedResult='''
# {
#     "status": "false",
#     "msg": "请求失败",
#     "code": 1,
#     "type": null,
#     "data": 0
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))